
public class Position implements Comparable<Position>{
	
	private int i;
	private int j;
	
	public Position(){
		this.i = -1;
		this.j = -1;
	}
	
	public Position(int i, int j){
		this.i = i;
		this.j = j;
	}
	
	public Position(Position p){
		this.i = p.i;
		this.j = p.j;
	}
	
	public boolean isEqual(Position p){
		if (this.i == p.i && this.j == p.j){
			return true;
		} 
		return false;
	}
	
	public String toString(){
		return "( " +i+" | "+ j +" )";
	}
	
	public int getI() {
		return i;
	}
	public void setI(int i) {
		this.i = i;
	}
	public int getJ() {
		return j;
	}
	public void setJ(int j) {
		this.j = j;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + i;
		result = prime * result + j;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Position other = (Position) obj;
		if (i != other.i)
			return false;
		if (j != other.j)
			return false;
		return true;
	}

	@Override
	public int compareTo(Position o) {
		if ( this.i > o.i){
			return 1;
		}
		if ( this.i < o.i){
			return -1;
		}
		
		if ( this.j > o.j){
			return 1;
		}
		if ( this.j < o.j){
			return -1;
		}
		
		return 0;
	}
	
	
}
